from django.db import models


# Create your models here.

class BaseModel(models.Model):
    is_delete = models.BooleanField(default=False)
    deleted_time = models.DateTimeField(null=True)
    update_time = models.DateTimeField(null=True)
    class Meta:
        abstract = True

class Car(BaseModel):
    id = models.AutoField(primary_key=True, verbose_name='车辆编号')
    carno = models.CharField(max_length=15, verbose_name='车牌号')
    owner = models.CharField(max_length=20, verbose_name='车主')
    brand = models.CharField(max_length=20, verbose_name='车子类信')


    class Meta:
        db_table = 'tb_car'



class Record(BaseModel):
    id = models.AutoField(primary_key=True, verbose_name='记录编号')
    reason = models.CharField(max_length=255, verbose_name='原因')
    makedate = models.DateTimeField(verbose_name='违章日期')
    punish = models.CharField(max_length=255, verbose_name='处罚内容')
    dealt = models.BooleanField(default=False, verbose_name='是否受理')
    car = models.ForeignKey(to=Car, on_delete=models.PROTECT, db_column='cno', verbose_name='车辆')

    class Meta:
        db_table = 'tb_record'
        # verbose_name = '违章记录'
        # verbose_name_plural = '违章记录'
